/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.usecase.preference;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.RGB;

import com.cea.papyrus.core.preference.PreferenceConstants;
import com.cea.papyrus.diagram.usecase.helper.NodeActorHelper;
import com.cea.papyrus.diagram.usecase.helper.NodeUseCaseHelper;

/**
 * Defines constants for use case diagram preferences.
 * 
 * @author Gilles Cannenterre
 * @since 23 oct. 06
 */
public class UseCaseDiagramPreferenceConstants {

	// Actor
	/**
	 * The Constant P_ACTOR_BACKGROUNDCOLOR.
	 */
	public static final String P_ACTOR_BACKGROUNDCOLOR = "UseCaseDiagramPreferenceConstants.Actor.backGroundColor";
	
	/**
	 * The Constant P_ACTOR_BORDERCOLOR.
	 */
	public static final String P_ACTOR_BORDERCOLOR = "UseCaseDiagramPreferenceConstants.Actor.borderColor";
	
	/**
	 * The Constant P_ACTOR_FONTCOLOR.
	 */
	public static final String P_ACTOR_FONTCOLOR = "UseCaseDiagramPreferenceConstants.Actor.fontColor";
	
	/**
	 * The Constant P_ACTOR_FONT.
	 */
	public static final String P_ACTOR_FONT = "UseCaseDiagramPreferenceConstants.Actor.font";
	
	/**
	 * The Constant P_ACTOR_APPEARANCE.
	 */
	public static final String P_ACTOR_APPEARANCE = "UseCaseDiagramPreferenceConstants.Actor.appearance";

	// UseCase
	/**
	 * The Constant P_USECASE_BACKGROUNDCOLOR.
	 */
	public static final String P_USECASE_BACKGROUNDCOLOR = "UseCaseDiagramPreferenceConstants.UseCase.backGroundColor";
	
	/**
	 * The Constant P_USECASE_BORDERCOLOR.
	 */
	public static final String P_USECASE_BORDERCOLOR = "UseCaseDiagramPreferenceConstants.UseCase.borderColor";
	
	/**
	 * The Constant P_USECASE_FONTCOLOR.
	 */
	public static final String P_USECASE_FONTCOLOR = "UseCaseDiagramPreferenceConstants.UseCase.fontColor";
	
	/**
	 * The Constant P_USECASE_FONT.
	 */
	public static final String P_USECASE_FONT = "UseCaseDiagramPreferenceConstants.UseCase.fontSize";
	
	/**
	 * The Constant P_USECASE_APPEARANCE.
	 */
	public static final String P_USECASE_APPEARANCE = "UseCaseDiagramPreferenceConstants.UseCase.appearance";
	
	// ExtensionPoint
	/**
	 * The Constant P_EXTENSIONPOINT_BACKGROUNDCOLOR.
	 */
	public static final String P_EXTENSIONPOINT_BACKGROUNDCOLOR = "UseCaseDiagramPreferenceConstants.ExtensionPoint.backGroundColor";
	
	/**
	 * The Constant P_EXTENSIONPOINT_BORDERCOLOR.
	 */
	public static final String P_EXTENSIONPOINT_BORDERCOLOR = "UseCaseDiagramPreferenceConstants.ExtensionPoint.borderColor";	
	
	/**
	 * The Constant P_EXTENSIONPOINT_FONTCOLOR.
	 */
	public static final String P_EXTENSIONPOINT_FONTCOLOR = "UseCaseDiagramPreferenceConstants.ExtensionPoint.fontColor";
	
	/**
	 * The Constant P_EXTENSIONPOINT_FONT.
	 */
	public static final String P_EXTENSIONPOINT_FONT = "UseCaseDiagramPreferenceConstants.ExtensionPoint.font";
	

	/**
	 * Gets the preference actor background color.
	 * 
	 * @param store the store
	 * 
	 * @return the preference actor background color
	 */
	public static RGB getPreferenceActorBackgroundColor(IPreferenceStore store) {
		return PreferenceConverter.getColor(store, P_ACTOR_BACKGROUNDCOLOR);
	}
	
	/**
	 * Gets the preference actor border color.
	 * 
	 * @param store the store
	 * 
	 * @return the preference actor border color
	 */
	public static RGB getPreferenceActorBorderColor(IPreferenceStore store) {
		return PreferenceConverter.getColor(store, P_ACTOR_BORDERCOLOR);
	}
	
	/**
	 * Gets the preference actor font color.
	 * 
	 * @param store the store
	 * 
	 * @return the preference actor font color
	 */
	public static RGB getPreferenceActorFontColor(IPreferenceStore store) {
		return PreferenceConverter.getColor(store, P_ACTOR_FONTCOLOR);
	}

	/**
	 * Gets the preference actor font.
	 * 
	 * @param store the store
	 * 
	 * @return the preference actor font
	 */
	public static FontData[] getPreferenceActorFont(IPreferenceStore store) {
		return PreferenceConverter.getFontDataArray(store, P_ACTOR_FONT);
	}
	
	/**
	 * Gets the preference actor appearance.
	 * 
	 * @param store the store
	 * 
	 * @return the preference actor appearance
	 */
	public static String getPreferenceActorAppearance(IPreferenceStore store) {
		return store.getString(P_ACTOR_APPEARANCE);
	}
	
	/**
	 * Gets the preference use case background color.
	 * 
	 * @param store the store
	 * 
	 * @return the preference use case background color
	 */
	public static RGB getPreferenceUseCaseBackgroundColor(IPreferenceStore store) {
		return PreferenceConverter.getColor(store, P_USECASE_BACKGROUNDCOLOR);
	}
	
	/**
	 * Gets the preference use case border color.
	 * 
	 * @param store the store
	 * 
	 * @return the preference use case border color
	 */
	public static RGB getPreferenceUseCaseBorderColor(IPreferenceStore store) {
		return PreferenceConverter.getColor(store, P_USECASE_BORDERCOLOR);
	}
	
	/**
	 * Gets the preference use case font color.
	 * 
	 * @param store the store
	 * 
	 * @return the preference use case font color
	 */
	public static RGB getPreferenceUseCaseFontColor(IPreferenceStore store) {
		return PreferenceConverter.getColor(store, P_USECASE_FONTCOLOR);
	}

	/**
	 * Gets the preference use case font.
	 * 
	 * @param store the store
	 * 
	 * @return the preference use case font
	 */
	public static FontData[] getPreferenceUseCaseFont(IPreferenceStore store) {
		return PreferenceConverter.getFontDataArray(store, P_USECASE_FONT);
	}
	
	/**
	 * Gets the preference use case appearance.
	 * 
	 * @param store the store
	 * 
	 * @return the preference use case appearance
	 */
	public static String getPreferenceUseCaseAppearance(IPreferenceStore store) {
		return store.getString(P_USECASE_APPEARANCE);
	}
	
	/**
	 * Gets the preference extension point background color.
	 * 
	 * @param store the store
	 * 
	 * @return the preference extension point background color
	 */
	public static RGB getPreferenceExtensionPointBackgroundColor(IPreferenceStore store) {
		return PreferenceConverter.getColor(store, P_EXTENSIONPOINT_BACKGROUNDCOLOR);
	}
	
	/**
	 * Gets the preference extension point border color.
	 * 
	 * @param store the store
	 * 
	 * @return the preference extension point border color
	 */
	public static RGB getPreferenceExtensionPointBorderColor(IPreferenceStore store) {
		return PreferenceConverter.getColor(store, P_EXTENSIONPOINT_BORDERCOLOR);
	}
	
	/**
	 * Gets the preference extension point font color.
	 * 
	 * @param store the store
	 * 
	 * @return the preference extension point font color
	 */
	public static RGB getPreferenceExtensionPointFontColor(IPreferenceStore store) {
		return PreferenceConverter.getColor(store, P_EXTENSIONPOINT_FONTCOLOR);
	}

	/**
	 * Gets the preference extension point font.
	 * 
	 * @param store the store
	 * 
	 * @return the preference extension point font
	 */
	public static FontData[] getPreferenceExtensionPointFont(IPreferenceStore store) {
		return PreferenceConverter.getFontDataArray(store, P_EXTENSIONPOINT_FONT);
	}

	/**
	 * Sets the default preferences of the Actor, UseCase and ExtensionPoint preference pages.
	 * 
	 * @param store the store
	 */
	public static void setDefaultPreferences(IPreferenceStore store) {
		// Actor
		PreferenceConverter.setDefault(store, P_ACTOR_BACKGROUNDCOLOR, PreferenceConstants.getPapyrusColorYellow());
		PreferenceConverter.setDefault(store, P_ACTOR_BORDERCOLOR, PreferenceConstants.getPapyrusColorBrown());
		PreferenceConverter.setDefault(store, P_ACTOR_FONTCOLOR, PreferenceConstants.getPapyrusColorBlack());
		PreferenceConverter.setDefault(store, P_ACTOR_FONT, new FontData("Arial", 10, SWT.BOLD));
		store.setDefault(P_ACTOR_APPEARANCE, NodeActorHelper.ACTOR_STICKMAN_FORM);

		// UseCase
		PreferenceConverter.setDefault(store, P_USECASE_BACKGROUNDCOLOR, PreferenceConstants.getPapyrusColorYellow());
		PreferenceConverter.setDefault(store, P_USECASE_BORDERCOLOR, PreferenceConstants.getPapyrusColorBrown());
		PreferenceConverter.setDefault(store, P_USECASE_FONTCOLOR, PreferenceConstants.getPapyrusColorBlack());
		PreferenceConverter.setDefault(store, P_USECASE_FONT, new FontData("Arial", 10, SWT.BOLD));
		store.setDefault(P_USECASE_APPEARANCE, NodeUseCaseHelper.USECASE_ELLIPSE_FORM);
	
		// ExtensionPoint
		PreferenceConverter.setDefault(store, P_EXTENSIONPOINT_BACKGROUNDCOLOR, PreferenceConstants.getPapyrusColorYellow());
		PreferenceConverter.setDefault(store, P_EXTENSIONPOINT_BORDERCOLOR, PreferenceConstants.getPapyrusColorBrown());
		PreferenceConverter.setDefault(store, P_EXTENSIONPOINT_FONTCOLOR, PreferenceConstants.getPapyrusColorBlack());
		PreferenceConverter.setDefault(store, P_EXTENSIONPOINT_FONT, new FontData("Arial", 10, SWT.BOLD));
	}		
}